package com.pkx.guide.holidays.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.pkx.guide.common.annotation.Log;
import com.pkx.guide.common.annotation.ORpose;
import com.pkx.guide.common.enums.BusinessType;
import com.pkx.guide.holidays.entity.THolidaysDate;
import com.pkx.guide.holidays.service.THolidaysDateService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 节假日信息表控制层
 *
 * @Author : YangLe
 * @create 2025/8/28 13:43
 */
@RestController
@RequestMapping("/holidays")
@Tag(name = "节假日信息表")
@Slf4j
@ORpose
public class THolidaysDateController {

    @Autowired
    private THolidaysDateService tHolidaysDateService;

    @Operation(summary = "节假日信息表分页列表")
    @GetMapping("/page")
    public IPage<THolidaysDate> getList(Page page, THolidaysDate tHolidaysDate) {
        return tHolidaysDateService.getList(page,tHolidaysDate);
    }

    @Operation(summary = "节假日信息表添加")
    @PostMapping("/add")
    @Log(title = "诱导屏信息表", businessType = BusinessType.INSERT)
    public Boolean add(@RequestBody  THolidaysDate tHolidaysDate){
        return tHolidaysDateService.add(tHolidaysDate);
    }


    @Operation(summary = "节假日信息表修改")
    @PostMapping("/modify")
    @Log(title = "诱导屏信息表", businessType = BusinessType.UPDATE)
    public Boolean modify(@RequestBody  THolidaysDate tHolidaysDate){
        return tHolidaysDateService.modify(tHolidaysDate);
    }

    @Operation(summary = "节假日信息表删除(单个条目)")
    @DeleteMapping(value = "/deleteById/{id}")
    @Log(title = "诱导屏信息表", businessType = BusinessType.DELETE)
    public Boolean deleteById(@PathVariable("id") Integer id){
        return tHolidaysDateService.deleteById(id);
    }


    @Operation(summary = "节假日信息表详情（单个条目）")
    @GetMapping(value = "/getById/{id}")
    public THolidaysDate getById(@PathVariable("id") Integer id){
        return tHolidaysDateService.getById(id);
    }
}
